package cn.cyh.queue_service.mapper;

import cn.cyh.queue_service.model.entity.Notice;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 通知公告Mapper接口
 */
@Mapper
public interface NoticeMapper extends BaseMapper<Notice> {
    
    /**
     * 获取当前有效的通知公告列表
     * 
     * @return 通知公告列表
     */
    @Select("SELECT * FROM sys_notice WHERE status = 1 AND start_time <= NOW() AND end_time >= NOW() ORDER BY priority DESC, create_time DESC")
    List<Notice> selectActiveNotices();
    
    /**
     * 获取首页展示的通知公告列表
     * 
     * @return 通知公告列表
     */
    @Select("SELECT * FROM sys_notice WHERE status = 1 AND start_time <= NOW() AND end_time >= NOW() ORDER BY priority DESC, create_time DESC LIMIT 5")
    List<Notice> selectHomePageNotices();
}